package 寒假作业.LeetCode;

public class Num263 {
    public boolean isUgly(int n) {
        if(n <= 0){
            return false;
        }
        int[] factors = {2,3,5};
        //当n可以整出{2，3，5}中任意一个数时，n/{2，3，5}
        //最终商为1说明是丑数
        for (int factor : factors){
            while (n % factor == 0){
                n /= factor;
            }
        }
        return n == 1;
    }
}
